home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d26 / inf_src.arc / GETTRUTH.C < prev    next >
C/C++ Source or Header  |  1986-03-14  |  1KB  |  74 lines

  1.  
  2.  
  3. /*****************************************************************
  4. **                                **
  5. **      Inference -- (C) Copyright 1985 George Hageman    **
  6. **                                **
  7. **        user-supported software:                **
  8. **                                **
  9. **            George Hageman                **
  10. **            P.O. Box 11234                **
  11. **            Boulder, Colorado 80302            **
  12. **                                **
  13. *****************************************************************/
  14.  
  15. /*************************************************
  16. **
  17. **    getTruth(antecedent) 
  18. **
  19. **    asks user for the truth of a string or
  20. **    returns --
  21. **        TRUE if user says the statement is TRUE
  22. **        FALSE if the user says the statement is FALSE
  23. **
  24. *************************************************/
  25.  
  26. #include <stdio.h>
  27.  
  28. #ifdef MSDOS
  29. #include <conio.h>
  30. #endif
  31.  
  32. #include "expert.h"
  33. #include "inference.h"
  34.  
  35. int getTruth(cnsquent)
  36.     int    cnsquent ;
  37. {
  38. int done,c ;
  39. done = FALSE ;
  40.  
  41. while(!done)
  42.     {
  43.     printf("\n Is the following statement True?  (T/F,Y/N)\n\n ") ;
  44.     printf("%s    ?",&strBuff[ruleBuff[cnsquent].string]) ;
  45. #ifdef MSDOS
  46.     c = getche() ;
  47. #endif
  48. #ifdef UNIXSV
  49.     c = getchar() ;    
  50.     getchar() ;
  51. #endif
  52.     switch(c) 
  53.         {
  54.         case 'y' :
  55.         case 'Y' :
  56.         case 't' :
  57.         case 'T' :
  58.             printf("\n\n") ;
  59.             return(TRUE) ;
  60.         case 'n' :
  61.         case 'N' :
  62.         case 'f' :
  63.         case 'F' :
  64.             printf("\n\n") ;
  65.             return(FALSE) ;
  66.         case 'w' :
  67.         case 'W' :
  68.             printf("\n Why is not implemented \n") ;
  69.         default :
  70.             printf("\n Please try again \"T\" or \"F\" \n ") ;
  71.         }
  72.     }
  73. }
  74.